﻿using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;

public class UiControl : BaseUi {
    public ControlBox ControlBox;
    public UiMenu UiMenu;
    public GameObject error;
    public Text infoText;
    // 统一这里初始化
    private void Awake () {
        Global.init ();
        MyJson.Init();
        ControlBox.init ();
        UiMenu.init ();
        init ();
    }
    public void init () {
        Global.GameProxy.UiControl = this;
        ControlBox.gameObject.SetActive(false);
        UiMenu.gameObject.SetActive(true);
    }
    public void showError (string info) {
        infoText.text = info;
        showUi (error);
    }
    //点击事件
    public override void _onClick (string btnTag, GameObject obj) {
        base._onClick (btnTag, obj);
        switch (btnTag) {
            case "closeError":
                closeUi (error);
                break;
            default:
                Debug.Log ("点击了" + btnTag + "未处理");
                break;
        }
    }
    public void showControl (bool isShow) {
        ControlBox.gameObject.SetActive (isShow);
        UiMenu.gameObject.SetActive (!isShow);
    }
}